﻿<views:RequestView
    x:Class="SpaceNeedle.x6473.WindowsPhone.Views.Request"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:views="clr-namespace:SpaceNeedle.x6473.WindowsPhone.Views"
    xmlns:controls="clr-namespace:SpaceNeedle.x6473.WindowsPhone.Controls"
    xmlns:viewmodels="clr-namespace:SpaceNeedle.x6473.WindowsPhone.ViewModels"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="True" shell:SystemTray.Opacity="0">

    <d:Page.DataContext>
        <viewmodels:RequestViewModelSampleData />
    </d:Page.DataContext>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="{Binding AppContent.Name}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock Text="nova solicitação" Style="{StaticResource PhoneTextTitle1Style}" FontSize="72" />
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <ScrollViewer x:Name="ContentPanel" Grid.Row="1">
            <StackPanel Orientation="Vertical"  Margin="28,0,0,0">

                <StackPanel Orientation="Horizontal" Margin="0,0,0,20">
                    <Border Width="96" Height="96" Background="{StaticResource PhoneAccentBrush}" VerticalAlignment="Top">
                        <Image Source="{Binding Request.Icon}" Width="64" Height="64" Stretch="UniformToFill" VerticalAlignment="Center"/>
                    </Border>
                    <StackPanel Orientation="Vertical" Margin="10,0,0,0" VerticalAlignment="Top" >
                        <TextBlock FontSize="36" Text="{Binding Request.Title}" TextTrimming="WordEllipsis"/>
                        <TextBlock FontSize="22" Margin="0,0,0,20" Foreground="Gray" Text="{Binding Request.Description}" MaxWidth="320" TextWrapping="Wrap" HorizontalAlignment="Left"/>
                    </StackPanel>
                </StackPanel>
                <StackPanel Margin="0,0,28,0">
                    <TextBlock Text="Endereço" FontSize="28"/>
                <!--<TextBlock Text="{Binding RequestItem.Address}" Foreground="Gray" Margin="0,0,0,20" HorizontalAlignment="Left" TextWrapping="Wrap"  VerticalAlignment="Top" FontSize="20" FontFamily="Segoe WP Light" />-->
                    <TextBox Name="addressTextBox" Text="{Binding UserTypedAddress, Mode=TwoWay}" HorizontalAlignment="Stretch" Margin="-10,0,-10,20" Height="90" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="20" FontFamily="Segoe WP Light" GotFocus="OnTextBox_GotFocus">
                        <TextBox.InputScope>
                            <InputScope>
                                <InputScopeName NameValue="Text" />
                            </InputScope>
                        </TextBox.InputScope>
                    </TextBox>

                <StackPanel x:Name="mapContainer" Orientation="Vertical" Visibility="Collapsed">
                    <TextBlock Text="Localização" FontSize="28" Margin="0,0,0,5"/>
                    <Image Source="{Binding MapAddress}" Margin="0,0,0,20" ImageOpened="OnMap_ImageOpened"/>
                </StackPanel>

                <TextBlock Text="Foto" FontSize="28" Margin="0,0,0,5"/>

                <Grid Margin="0,0,0,20" MinHeight="100" HorizontalAlignment="Stretch" VerticalAlignment="Top" >
                    <Grid.Background>
                        <ImageBrush ImageSource="/Assets/photo-background.png" Stretch="None"/>
                    </Grid.Background>

                    <TextBlock Text="&#xE114;" FontSize="42" HorizontalAlignment="Center" VerticalAlignment="Center"  FontFamily="Segoe UI Symbol" Foreground="{StaticResource PhoneAccentBrush}" Tap="OnRequestPhotoImage_Tap"/>
                    <Image Name="requestPhotoImage" Stretch="Uniform" Source="{Binding RequestItem.Photo}" Tap="OnRequestPhotoImage_Tap"/>
                </Grid>

                <TextBlock Text="{Binding AppContent.Request.DescriptionText}" FontSize="28"/>

                <!--<TextBlock Text="{Binding RequestItem.Description}" Margin="0,5,0,40" HorizontalAlignment="Left" Foreground="Gray"  TextWrapping="Wrap"  VerticalAlignment="Top" FontSize="20" FontFamily="Segoe WP Light" />-->


                <!--<StackPanel Orientation="Horizontal">
                    <Border x:Name="requestPhotoBorder" Background="LightGray" Tap="OnPhotoBorder_Tap" Width="100" Height="100" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="23,12,0,0">
                        <Image Name="requestPhotoImage" Stretch="Uniform" Tap="OnRequestPhotoImage_Tap"  />
                    </Border>
                    <TextBox x:Name="addressTextBox" HorizontalAlignment="Left" Height="125" Margin="35,0,0,0" TextWrapping="Wrap" Text="{Binding StaticContent.AddressText}" VerticalAlignment="Top" Width="289" FontSize="20" FontFamily="Segoe WP Light"/>
                </StackPanel>-->

                <!--<TextBlock HorizontalAlignment="Left" Margin="22,0,0,0" TextWrapping="Wrap" Text="{Binding DescriptionTitle}" VerticalAlignment="Top" FontFamily="Segoe WP"/>-->
                    <TextBox Name="descriptionTextBox" Text="{Binding UserTypedDescription, Mode=TwoWay}" HorizontalAlignment="Stretch" Height="130" Margin="-10,0,-10,20" TextWrapping="Wrap" VerticalAlignment="Top"  FontSize="20" FontFamily="Segoe WP Light" GotFocus="OnTextBox_GotFocus">
                        <TextBox.InputScope>
                            <InputScope>
                                <InputScopeName NameValue="Text" />
                            </InputScope>
                        </TextBox.InputScope>
                    </TextBox>
                <!--<TextBlock HorizontalAlignment="Left" Margin="22,10,0,0" TextWrapping="Wrap" Text="{Binding AppContent.Request.RequestTip}" VerticalAlignment="Top" Width="398" Height="88" FontFamily="Segoe WP"/>-->
                <CheckBox x:Name="shareCheckBox" Content="{Binding ShareText}" Margin="0,0,0,40"/>

            </StackPanel>
            </StackPanel>
        </ScrollViewer>

        <Grid x:Name="pictureOptions" Background="{StaticResource PhoneAccentBrush}" Grid.RowSpan="2" Visibility="Collapsed">
            <StackPanel Orientation="Vertical" Margin="40,0,40,0" VerticalAlignment="Center">
                <Button Content="Câmera" Click="OnCameraButton_Click"  Foreground="White" BorderBrush="White"></Button>
                <Button Content="Albuns" Click="OnAlbunsButton_Click" Foreground="White" BorderBrush="White"></Button>
                <Button Content="Cancelar" Click="OnCancelButton_Click" Foreground="White" BorderBrush="White"></Button>
            </StackPanel>
        </Grid>

        <Grid x:Name="sendRequestMessage" Background="{StaticResource PhoneAccentBrush}" Grid.RowSpan="2" Visibility="Collapsed">
            <StackPanel Orientation="Vertical" Margin="40,0,40,0" VerticalAlignment="Center">
                <TextBlock Text="Estamos finalizando o envio da foto de sua solicitação! Assim que o processo for finalizado, sua solicitação estará disponível." TextWrapping="Wrap"/>
                <Button Content="OK" Click="OnOkButton_Click"  Foreground="White" BorderBrush="White" Margin="0,40,0,0" />
            </StackPanel>
        </Grid>

        <ProgressBar Visibility="{Binding IsInProgress, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource ProgressStyle}" VerticalAlignment="Top" />
        <controls:NewtworkStatusControl/>

    </Grid>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar Opacity="1.0" IsMenuEnabled="True" IsVisible="True">
            <shell:ApplicationBarIconButton x:Name="takePictureAppBarButton" IconUri="/Assets/AppBar/feature.camera.png" Text="tirar foto" Click="OnTakePictureAppBarButton_Click"/>
            <shell:ApplicationBarIconButton x:Name="sendRequestAppBarButton" IconUri="/Assets/Icons/Dark/check.png" Text="enviar" Click="OnSendRequestAppBarButton_Click"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem x:Name="uploadsMenuItem" Text="uploads" Click="OnUploadsMenuItem_Click"/>
                <shell:ApplicationBarMenuItem x:Name="aboutMenuItem" Text="sobre" Click="OnAboutMenuItem_Click"/>
                <shell:ApplicationBarMenuItem x:Name="signoutMenuItem" Text="sair" Click="OnSignOutMenuItem_Click"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</views:RequestView>